<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,maximum-scale=1.0" />
    <title><#if entity.menuId??>编辑<#else>新增</#if>菜单栏</title>
    <#include "/view/admin/head.html"/>
    <script type="text/javascript" src="${base}/jstool/bootstrap-switch/bootstrap-switch.min.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-switch/bootstrap-switch.min.css" />
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" />


    <script type="text/javascript" src="${base}/jstool/bootstrap-validator-0.5.3/js/bootstrapValidator.min.js"></script>
    <script type="text/javascript" src="${base}/jstool/bootstrap-validator-0.5.3/lang/zh_CN.min.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-validator-0.5.3/css/bootstrapValidator.min.css" />


    <style type="text/css">
        .list-path {
            height: 50px;
            line-height: 50px;
            background-color: #9acfea;
        }

        .table-class {
            width: 80%;
            text-align: center;
            border: 1px solid #afd9ee;
            margin: 0 auto;
            margin-top: 50px;
        }

        table th {
            width: 20%;
            background-color: #d9edf7;
            text-align: right;
        }

        table td {
            width: 20%;
            text-align: left;
        }


    </style>
    <script type="text/javascript">

        $(function(){
            //初始化






                    $('[name="statuscb"]').bootstrapSwitch({
                                onText:"显示",
                                offText:"隐藏",
                        onColor:"success",
                        offColor:"info",
                        size:"small",
                        onSwitchChange:function(event,state){
                            if(state==true){
                                $(this).val("1");
                                $('[name="status"]').val("1");
                            }else{
                                $(this).val("0");
                                $('[name="status"]').val("0");
                            }
                        }
                    });
                    $('[name="hasMenucb"]').bootstrapSwitch({
                                onText:"是",
                                offText:"否",
                        onColor:"success",
                        offColor:"info",
                        size:"small",
                        onSwitchChange:function(event,state){
                            if(state==true){
                                $(this).val("1");
                                $('[name="hasMenu"]').val("1");
                            }else{
                                $(this).val("0");
                                $('[name="hasMenu"]').val("0");
                            }
                        }
                    });
                    $('[name="ifMenucb"]').bootstrapSwitch({
                                onText:"菜单",
                                offText:"按钮",
                        onColor:"success",
                        offColor:"info",
                        size:"small",
                        onSwitchChange:function(event,state){
                            if(state==true){
                                $(this).val("1");
                                $('[name="ifMenu"]').val("1");
                            }else{
                                $(this).val("0");
                                $('[name="ifMenu"]').val("0");
                            }
                        }
                    });



            $('#xymenuForm').bootstrapValidator({
                message: 'This value is not valid',
                feedbackIcons: {
                    valid: 'glyphicon glyphicon-ok',
                    invalid: 'glyphicon glyphicon-remove',
                    validating: 'glyphicon glyphicon-refresh'
                },
                fields: {



                    
                name:{
                    message: '输入菜单名称出错',
                    validators:{
                        notEmpty: {
                            message: '菜单名称不能为空'
                        },
                        stringLength:{
                            max: 19,
                            message: '菜单名称不能超过 19个字符'
                        }
                    }
                }

                    ,
                nameEn:{
                    message: '输入菜单标识出错',
                    validators:{
                        notEmpty: {
                            message: '菜单标识不能为空'
                        },
                        stringLength:{
                            max: 19,
                            message: '菜单标识不能超过 19个字符'
                        }
                    }
                }

                    ,
                url:{
                    message: '输入链接出错',
                    validators:{
                        notEmpty: {
                            message: '链接不能为空'
                        },
                        stringLength:{
                            max: 50,
                            message: '链接不能超过 50个字符'
                        }
                    }
                }



                    ,
                orderBy:{
                    message: '输入排序出错',
                    validators:{
                        notEmpty: {
                            message: '排序不能为空'
                        },
                        stringLength:{
                            max: 2,
                            message: '排序不能超过 2个字符'
                        },
                        regexp: {
                            regexp: /^[0-9]+$/,
                                    message:'排序只能是数字'
                        }
                    }
                }






                }
            });


        });

    </script>
</head>
<body>

<#include "/view/admin/listnav.html"/>


<div class="table-class">
    <#include "/view/admin/opermsg.html"/>
    <form id="xymenuForm" action="${base}/xymenu/save.do"
     >
    <table class="table table-bordered">

                        <input type="hidden" style="display: none" name="menuId" value="${entity.menuId!}"/>

        <tr>


            <th>上级菜单</th>
            <td>

                        <#list listParentId as lv>
                            <#if lv.value??&&entity.parentId??&&entity.parentId == lv.value >
                                <input type="hidden" name="parentId" value="${lv.value!}"/>
                                ${lv.name!}
                            </#if>
                        </#list>

            </td>
        </tr>

                <tr>
                <th>菜单名称</th>
                <td>
                    <div class="form-group">
                        <input type="text" class="form-control" id="name" name="name" placeholder="请输入菜单名称" value="${entity.name!}">
                    </div>
                </td>
                </tr>
                <tr>
                
                <th>菜单标识</th>
                <td>
                    <div class="form-group">
                        <input type="text" class="form-control" id="nameEn" name="nameEn" placeholder="请输入菜单标识" value="${entity.nameEn!}">
                    </div>
                </td>
                </tr>

                <tr>
                <th>链接</th>
                <td>
                    <div class="form-group">
                        <input type="text" class="form-control" id="url" name="url" placeholder="请输入链接" value="${entity.url!}">
                    </div>
                </td>
                </tr>

                <tr>
                <th>排序</th>
                <td>
                    <div class="form-group">
                        <input type="text" class="form-control" id="orderBy" name="orderBy" placeholder="请输入排序" value="${entity.orderBy!}">
                    </div>
                </td>
                </tr>
        <tr>

                
                <th>显示或隐藏</th>
                <td>
                <input name="status" type="hidden" value="<#if entity.status??>${entity.status}<#else>0</#if>"/>
                <input name="statuscb" type="checkbox"  data-size="small"
                       <#if entity.status??>
                        <#if 1==entity.status>
                            checked="checked"
                            value="1"</#if>
                        <#if 0==entity.status>
                            value="0"</#if>
                </#if>/>
                </td>
                </tr>



                <tr>




                
                <th>菜单或按钮</th>
                <td>
                <input name="ifMenu" type="hidden" value="<#if entity.ifMenu??>${entity.ifMenu}<#else>0</#if>"/>
                <input name="ifMenucb" type="checkbox"  data-size="small"
                       <#if entity.ifMenu??>
                        <#if 1==entity.ifMenu>
                            checked="checked"
                            value="1"</#if>
                        <#if 0==entity.ifMenu>
                            value="0"</#if>
                </#if>/>
                </td>
                </tr>




        <tr>
            <td colspan="2" width="100%" style="text-align: center;">
                <input type="submit" class="btn btn-success " value="保存"/>
                <span style="width: 20px;">&nbsp;</span>
                <a class="btn btn-danger " href="javascript:window.history.go(-1)">
                   </span>返回</a>
            </td>
        </tr>

    </table>
</form>




</div>

<script type="text/javascript">

</script>


</body>
</html>
